package com.jee.servlet;

import java.io.IOException;

import javax.servlet.GenericServlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;


/**
 * @author zhuxiaodong
 *
 */
public class LoadServletA extends GenericServlet {
	private static final long serialVersionUID = 1L;
	
	@Override
	public void init() throws ServletException {
		System.out.println("initing...()");
		super.init();
	}

	@Override
	public void init(ServletConfig config) throws ServletException {
		System.out.println("initing...(config)");
		super.init(config);
	}
	
	@Override
	public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
		HttpServletRequest request = (HttpServletRequest)req;
		System.out.println("-----------------A Servlet start-------------");
		System.out.println(request.getRequestURI());
		System.out.println(request.getRequestURL());
		request.setAttribute("url", request.getRequestURL());
		request.setAttribute("uri", request.getRequestURI());
		request.getRequestDispatcher("index.jsp").forward(request,res);
	}
}
